package com.example.baselibrary.db.table;

import android.text.TextUtils;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * 头像挂件维护表
 *
 * @author: NPF
 * @date: 2018/7/11.
 */
@DatabaseTable(tableName = "avatarPendant")
public class AvatarPendantTable {
    @DatabaseField(columnName = "account", id = true)
    public String account;//帐号
    @DatabaseField(columnName = "pendantUrl")
    public String pendantUrl;//挂件地址
    @DatabaseField(columnName = "failureTime")
    public long failureTime;//挂件过期时间

    public AvatarPendantTable() {
    }

    /**
     * @param account     帐号
     * @param pendantUrl  挂件地址
     * @param failureTime 挂件过期时间
     */
    public AvatarPendantTable(String account, String pendantUrl, String failureTime) {
        this.account = TextUtils.isEmpty(account) ? "" : account;
        this.pendantUrl = TextUtils.isEmpty(pendantUrl) ? "" : pendantUrl;
        try {
            this.failureTime = TextUtils.isEmpty(failureTime) ? System.currentTimeMillis() : Long.valueOf(failureTime);
        } catch (Exception e) {
            this.failureTime = System.currentTimeMillis();
        }
    }
}
